<!DOCTYPE html>
<html>
<base href="__STATIC__/admin/">
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="renderer" content="webkit">

    <title>素材火www.sucaihuo.com - 数据表格</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">

    <link href="css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="font-awesome/css/font-awesome.css?v=4.3.0" rel="stylesheet">

    <!-- Data Tables -->
    <link href="css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">

    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=2.2.0" rel="stylesheet">

</head>

<body>
    <div id="wrapper">
        <nav class="navbar-default navbar-static-side" role="navigation">
            <div class="sidebar-collapse">
                <ul class="nav" id="side-menu">
                    <li class="nav-header">

                        <div class="dropdown profile-element"> <span>
                            <img alt="image" class="img-circle" src="img/profile_small.jpg" />
                             </span>
                            <a data-toggle="dropdown" class="dropdown-toggle" href="index.html#">
                                <span class="clear"> <span class="block m-t-xs"> <strong class="font-bold">Beaut-zihan</strong>
                             </span>  <span class="text-muted text-xs block">超级管理员 <b class="caret"></b></span> </span>
                            </a>
                            <ul class="dropdown-menu animated fadeInRight m-t-xs">
                                <li><a href="form_avatar.html">修改头像</a>
                                </li>
                                <li><a href="profile.html">个人资料</a>
                                </li>
                                <li><a href="contacts.html">联系我们</a>
                                </li>
                                <li><a href="mailbox.html">信箱</a>
                                </li>
                                <li class="divider"></li>
                                <li><a href="login.html">安全退出</a>
                                </li>
                            </ul>
                        </div>
                        <div class="logo-element">
                            H+
                        </div>

                    </li>
                    <li>
                        <a href="index.html"><i class="fa fa-th-large"></i> <span class="nav-label">用户管理</span> <span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="index_1.html">用户列表</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="layouts.html"><i class="fa fa-columns"></i> <span class="nav-label">商品管理</span><span class="label label-danger pull-right"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="{:url('admin/index/table_data_tables')}">商品列表</a>
                            </li>
                        </ul>
                    </li>                    
                    <li>
                        <a href="index.html#"><i class="fa fa fa-globe"></i> <span class="nav-label">管理员管理</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="toastr_notifications.html">管理员列表</a>
                            </li>
                        </ul>
                    </li>

                    <li>
                        <a href="index.html#"><i class="fa fa-bar-chart-o"></i> <span class="nav-label">轮播图管理</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="graph_echarts.html">轮播图列表</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="mailbox.html"><i class="fa fa-envelope"></i> <span class="nav-label">广告位管理</span><span class="label label-warning pull-right"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="mailbox.html">广告位列表</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="widgets.html"><i class="fa fa-flask"></i> <span class="nav-label">品牌管理</span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="mailbox.html">品牌列表</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="index.html#"><i class="fa fa-edit"></i> <span class="nav-label">商品分类管理</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="form_basic.html">商品分类列表</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="index.html#"><i class="fa fa-desktop"></i> <span class="nav-label">评价管理</span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="contacts.html">评价列表</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="index.html#"><i class="fa fa-files-o"></i> <span class="nav-label">投诉管理</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="search_results.html">投诉列表</a>
                            </li>
                        </ul>
                    </li>

                    <li>
                        <a href="index.html#"><i class="fa fa-flask"></i> <span class="nav-label">商家管理</span><span class="fa arrow"></span></a>
                        <ul class="nav nav-second-level">
                            <li><a href="typography.html">商家列表</a>
                            </li>
                        </ul>
                    </li>
                    <li>
                        <a href="grid_options.html"><i class="fa fa-laptop"></i> <span class="nav-label">系统设置</span></a>
                    </li>
                    <!--<li class="active">-->
                        <!--<a href="index.html#"><i class="fa fa-table"></i> <span class="nav-label">表格</span><span class="fa arrow"></span></a>-->
                        <!--<ul class="nav nav-second-level">-->
                            <!--<li><a href="table_basic.html">基本表格</a>-->
                            <!--</li>-->
                            <!--<li class="active"><a href="table_data_tables.html">数据表格(DataTables)</a>-->
                            <!--</li>-->
                            <!--<li><a href="table_jqgrid.html">jqGrid</a>-->
                            <!--</li>-->
                        <!--</ul>-->
                    <!--</li>-->
                    <!--<li>-->
                        <!--<a href="index.html#"><i class="fa fa-picture-o"></i> <span class="nav-label">图库</span><span class="fa arrow"></span></a>-->
                        <!--<ul class="nav nav-second-level">-->
                            <!--<li><a href="basic_gallery.html">基本图库</a>-->
                            <!--</li>-->
                            <!--<li><a href="carousel.html">图片切换</a>-->
                            <!--</li>-->

                        <!--</ul>-->
                    <!--</li>-->
                    <!--<li>-->
                        <!--<a href="index.html#"><i class="fa fa-sitemap"></i> <span class="nav-label">菜单 </span><span class="fa arrow"></span></a>-->
                        <!--<ul class="nav nav-second-level">-->
                            <!--<li>-->
                                <!--<a href="index.html#">三级菜单 <span class="fa arrow"></span></a>-->
                                <!--<ul class="nav nav-third-level">-->
                                    <!--<li>-->
                                        <!--<a href="index.html#">三级菜单 01</a>-->
                                    <!--</li>-->
                                    <!--<li>-->
                                        <!--<a href="index.html#">三级菜单 01</a>-->
                                    <!--</li>-->
                                    <!--<li>-->
                                        <!--<a href="index.html#">三级菜单 01</a>-->
                                    <!--</li>-->

                                <!--</ul>-->
                            <!--</li>-->
                            <!--<li><a href="index.html#">二级菜单</a>-->
                            <!--</li>-->
                            <!--<li>-->
                                <!--<a href="index.html#">二级菜单</a>-->
                            <!--</li>-->
                            <!--<li>-->
                                <!--<a href="index.html#">二级菜单</a>-->
                            <!--</li>-->
                        <!--</ul>-->
                    <!--</li>-->
                    <!--<li>-->
                        <!--<a href="webim.html"><i class="fa fa-comments"></i> <span class="nav-label">即时通讯</span><span class="label label-danger pull-right">New</span></a>-->
                    <!--</li>-->
                    <!--<li>-->
                        <!--<a href="css_animation.html"><i class="fa fa-magic"></i> <span class="nav-label">CSS动画</span></a>-->
                    <!--</li>-->
                    <!--<li>-->
                        <!--<a href="index.html#"><i class="fa fa-cutlery"></i> <span class="nav-label">工具 </span><span class="fa arrow"></span></a>-->
                        <!--<ul class="nav nav-second-level">-->
                            <!--<li><a href="form_builder.html">表单构建器</a>-->
                            <!--</li>-->
                        <!--</ul>-->
                    <!--</li>-->
                </ul>

            </div>
        </nav>

        <div id="page-wrapper" class="gray-bg dashbard-1">
            <div class="row border-bottom">
                <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
                    <div class="navbar-header">
                        <a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="table_data_tables.html#"><i class="fa fa-bars"></i> </a>
                        <form role="search" class="navbar-form-custom" method="post" action="search_results.html">
                            <div class="form-group">
                                <input type="text" placeholder="请输入您需要查找的内容 …" class="form-control" name="top-search" id="top-search">
                            </div>
                        </form>
                    </div>
                    <ul class="nav navbar-top-links navbar-right">
                        <li>
                            <span class="m-r-sm text-muted welcome-message"><a href="index.html" title="返回首页"><i class="fa fa-home"></i></a>欢迎使用H+后台主题</span>
                        </li>
                        <li class="dropdown">
                            <a class="dropdown-toggle count-info" data-toggle="dropdown" href="index.html#">
                                <i class="fa fa-envelope"></i>  <span class="label label-warning">16</span>
                            </a>
                            <ul class="dropdown-menu dropdown-messages">
                                <li>
                                    <div class="dropdown-messages-box">
                                        <a href="profile.html" class="pull-left">
                                            <img alt="image" class="img-circle" src="img/a7.jpg">
                                        </a>
                                        <div class="media-body">
                                            <small class="pull-right">46小时前</small>
                                            <strong>小四</strong> 项目已处理完结
                                            <br>
                                            <small class="text-muted">3天前 2014.11.8</small>
                                        </div>
                                    </div>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <div class="dropdown-messages-box">
                                        <a href="profile.html" class="pull-left">
                                            <img alt="image" class="img-circle" src="img/a4.jpg">
                                        </a>
                                        <div class="media-body ">
                                            <small class="pull-right text-navy">25小时前</small>
                                            <strong>国民岳父</strong> 这是一条测试信息
                                            <br>
                                            <small class="text-muted">昨天</small>
                                        </div>
                                    </div>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <div class="text-center link-block">
                                        <a href="mailbox.html">
                                            <i class="fa fa-envelope"></i>  <strong> 查看所有消息</strong>
                                        </a>
                                    </div>
                                </li>
                            </ul>
                        </li>
                        <li class="dropdown">
                            <a class="dropdown-toggle count-info" data-toggle="dropdown" href="index.html#">
                                <i class="fa fa-bell"></i>  <span class="label label-primary">8</span>
                            </a>
                            <ul class="dropdown-menu dropdown-alerts">
                                <li>
                                    <a href="mailbox.html">
                                        <div>
                                            <i class="fa fa-envelope fa-fw"></i> 您有16条未读消息
                                            <span class="pull-right text-muted small">4分钟前</span>
                                        </div>
                                    </a>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <a href="profile.html">
                                        <div>
                                            <i class="fa fa-qq fa-fw"></i> 3条新回复
                                            <span class="pull-right text-muted small">12分钟钱</span>
                                        </div>
                                    </a>
                                </li>
                                <li class="divider"></li>
                                <li>
                                    <div class="text-center link-block">
                                        <a href="notifications.html">
                                            <strong>查看所有 </strong>
                                            <i class="fa fa-angle-right"></i>
                                        </a>
                                    </div>
                                </li>
                            </ul>
                        </li>


                        <li>
                            <a href="login.html">
                                <i class="fa fa-sign-out"></i> 退出
                            </a>
                        </li>
                    </ul>

                </nav>
            </div>
            <div class="row wrapper border-bottom white-bg page-heading">
                <div class="col-lg-10">
                    <h2>数据表格</h2>
                    <ol class="breadcrumb">
                        <li>
                            <a href="index.html">主页</a>
                        </li>
                        <li>
                            <a>表格</a>
                        </li>
                        <li>
                            <strong>数据表格</strong>
                        </li>
                    </ol>
                </div>
                <div class="col-lg-2">

                </div>
            </div>
            <div class="wrapper wrapper-content animated fadeInRight">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="ibox float-e-margins">
                            <div class="ibox-title">
                                <h5>基本 <small>分类，查找</small></h5>
                                <div class="ibox-tools">
                                    <a class="collapse-link">
                                        <i class="fa fa-chevron-up"></i>
                                    </a>
                                    <a class="dropdown-toggle" data-toggle="dropdown" href="table_data_tables.html#">
                                        <i class="fa fa-wrench"></i>
                                    </a>
                                    <ul class="dropdown-menu dropdown-user">
                                        <li><a href="table_data_tables.html#">选项1</a>
                                        </li>
                                        <li><a href="table_data_tables.html#">选项2</a>
                                        </li>
                                    </ul>
                                    <a class="close-link">
                                        <i class="fa fa-times"></i>
                                    </a>
                                </div>
                            </div>
                            <div class="ibox-content">

                                <table class="table table-striped table-bordered table-hover dataTables-example">
                                    <thead>
                                        <tr>
                                            <th>商品ID</th>
                                            <th>商品名称</th>
                                            <th>所属店铺</th>
                                            <th>所属品牌</th>
                                            <th>商品描述</th>
                                            <th>添加时间</th>
                                            <th>状态</th>
                                            <th>商品编号</th>
                                            <th>库存</th>
                                            <th>商品广告语</th>
                                            <th>是否热卖</th>
                                            <th>是否新品</th>
                                            <th>是否下架</th>
                                            <th>销量</th>
                                            <th>浏览量</th>
                                            <th>操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                    <?php foreach($data as $key => $val){ ?>
                                        <tr class="gradeX"  where="<?= $val['g_id'] ?>">
                                            <td><?= $val['g_id'] ?></td>
                                            <td><?= $val['g_name'] ?></td>
                                            <td><?= $val['m_name'] ?></td>
                                            <td><?= $val['b_name'] ?></td>
                                            <td><?= $val['g_content'] ?></td>
                                            <td><?php echo date('Y-m-d H:i:s',$val['g_addtime'])?></td>
                                            <td>
                                                <?php if($val['g_statc'] == 1) { ?>
                                                    <button id="tj">推荐中</button>
                                                <?php }else{ ?>
                                                    <button id="btj">不推荐</button>
                                                <?php } ?>
                                            </td>
                                            <td><?= $val['g_number'] ?></td>
                                            <td><?= $val['g_num'] ?></td>
                                            <td><?= $val['g_intro'] ?></td>
                                            <td>
                                                <?php if($val['g_is_hot'] == 1) { ?>
                                                <button id="re">Yes</button>

                                                <?php }else{ ?>
                                                <button id="bre">No</button>
                                                <?php } ?>
                                            </td>
                                            <td>
                                                <?php if($val['g_is_new'] == 1) { ?>
                                                <button id="isnew">Yes</button>
                                                <?php }else{ ?>
                                                <button id="bnew">No</button>
                                                <?php } ?>
                                            </td>
                                            <td>
                                                <?php if($val['g_is_del'] == 1) { ?>
                                                <button id="isdel">Yes</button>
                                                <?php }else{ ?>
                                                <button id="bdel">No</button>
                                                <?php } ?>
                                            </td>
                                            <td><?= $val['g_sales'] ?></td>
                                            <td><?= $val['g_views'] ?></td>
                                            <td>
                                                <!--<a href="{:url('admin/index/goodsdel')}?g_id=<?=$val['g_id']?>">删除</a>-->
                                                <!--<a href="{:url('admin/index/goodsup')}?g_id=<?=$val['g_id']?>">修改</a>-->
                                                <button id="del">删除</button>
                                            </td>
                                        </tr>
                                    <?php } ?>
                                    </tbody>
                                </table>

                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>


    </div>

    <!-- Mainly scripts -->
    <script src="js/jquery-2.1.1.min.js"></script>
    <script src="js/bootstrap.min.js?v=3.4.0"></script>
    <script src="js/plugins/metisMenu/jquery.metisMenu.js"></script>
    <script src="js/plugins/slimscroll/jquery.slimscroll.min.js"></script>

    <script src="js/plugins/jeditable/jquery.jeditable.js"></script>

    <!-- Data Tables -->
    <script src="js/plugins/dataTables/jquery.dataTables.js"></script>
    <script src="js/plugins/dataTables/dataTables.bootstrap.js"></script>

    <!-- Custom and plugin javascript -->
    <script src="js/hplus.js?v=2.2.0"></script>
    <script src="js/plugins/pace/pace.min.js"></script>

    <!-- Page-Level Scripts -->
    <script>

        $(document).on("click","#del",function () {
            var g_id = $(this).parents('tr').attr('where');
            var obj = $(this);
            $.get("{:url('brand/goodsdel')}", {g_id:g_id },
                function(data){

                    obj.parents('tr').remove();

                });
        })
        $(document).on("click","#tj",function(){
            var g_id = $(this).parents('tr').attr('where');
            var txt = $(this).text();
            var obj = $(this);
            if(txt=='推荐中') {
               var  p='不推荐';
            }else{
                 p='推荐中'
            }
            $.get("{:url('brand/zt')}", { p:p ,g_id:g_id},
                function(data){
                    if(data==1)
                    {
                        obj.replaceWith('<button id="btj">'+p+'</button>');
                    }
                });

        })
        $(document).on("click","#btj",function(){
            var g_id = $(this).parents('tr').attr('where');
            var txt = $(this).text();
            var obj = $(this);
            if(txt=='不推荐') {
                var  p='推荐中';
            }else{
                p='不推荐'
            }
            $.get("{:url('brand/zt1')}", { p:p ,g_id:g_id},
                function(data){
                    if(data==1)
                    {
                        obj.replaceWith('<button id="tj">'+p+'</button>');
                    }
            });
        })
        $(document).on("click","#re",function(){
            var g_id = $(this).parents('tr').attr('where');
            var txt = $(this).text();
            var obj = $(this);
            if (txt=='Yes'){
                var p = 'No';
            } else{
                p = 'Yes';
            }
            $.get("{:url('brand/re')}", { p:p ,g_id:g_id},
                function(data){
                    if(data==1)
                    {
                        obj.replaceWith('<button id="bre">'+p+'</button>');
                    }
                });
        })
        $(document).on("click","#bre",function(){
            var g_id = $(this).parents('tr').attr('where');
            var txt = $(this).text();
            var obj = $(this);
            if (txt=='No'){
                var p = 'Yes';
            } else{
                p = 'No';
            }
            $.get("{:url('brand/bre')}", { p:p ,g_id:g_id},
                function(data){
                    if(data==1)
                    {
                        obj.replaceWith('<button id="re">'+p+'</button>');
                    }
                });
        })
        $(document).on("click","#isnew",function(){
            var g_id = $(this).parents('tr').attr('where');
            var txt = $(this).text();
            var obj = $(this);
            if (txt=='Yes'){
                var p = 'No';
            } else{
                p = 'Yes';
            }
            $.get("{:url('brand/isnew')}", { p:p ,g_id:g_id},
                function(data){
                    if(data==1)
                    {
                        obj.replaceWith('<button id="bnew">'+p+'</button>');
                    }
                });
        })
        $(document).on("click","#bnew",function(){
            var g_id = $(this).parents('tr').attr('where');
            var txt = $(this).text();
            var obj = $(this);
            if (txt=='No'){
                var p = 'Yes';
            } else{
                p = 'No';
            }
            $.get("{:url('brand/bnew')}", { p:p ,g_id:g_id},
                function(data){
                    if(data==1)
                    {
                        obj.replaceWith('<button id="isnew">'+p+'</button>');
                    }
                });
        })
        $(document).on("click","#isdel",function(){
            var g_id = $(this).parents('tr').attr('where');
            var txt = $(this).text();
            var obj = $(this);
            if (txt=='Yes'){
                var p = 'No';
            } else{
                p = 'Yes';
            }
            $.get("{:url('brand/isdel')}", { p:p ,g_id:g_id},
                function(data){
                    if(data==1)
                    {
                        obj.replaceWith('<button id="bdel">'+p+'</button>');
                    }
                });
        })
        $(document).on("click","#bdel",function(){
            var g_id = $(this).parents('tr').attr('where');
            var txt = $(this).text();
            var obj = $(this);
            if (txt=='No'){
                var p = 'Yes';
            } else{
                p = 'No';
            }
            $.get("{:url('brand/bdel')}", { p:p ,g_id:g_id},
                function(data){
                    if(data==1)
                    {
                        obj.replaceWith('<button id="isdel">'+p+'</button>');
                    }
                });
        })

        $(document).ready(function () {
            $('.dataTables-example').dataTable();

            /* Init DataTables */
            var oTable = $('#editable').dataTable();

            /* Apply the jEditable handlers to the table */
            oTable.$('td').editable('../example_ajax.php', {
                "callback": function (sValue, y) {
                    var aPos = oTable.fnGetPosition(this);
                    oTable.fnUpdate(sValue, aPos[0], aPos[1]);
                },
                "submitdata": function (value, settings) {
                    return {
                        "row_id": this.parentNode.getAttribute('id'),
                        "column": oTable.fnGetPosition(this)[2]
                    };
                },

                "width": "90%",
                "height": "100%"
            });


        });
        function fnClickAddRow() {
            $('#editable').dataTable().fnAddData([
                "Custom row",
                "New row",
                "New row",
                "New row",
                "New row"]);

        }
    </script>
    <script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script><!--统计代码，可删除-->
</body>
</html>
